import scrapy


class TcSpider(scrapy.Spider):
    name = 'tc'
    allowed_domains = ['bj.58.com']
    # 注意：如果你的请求的接口是HTML为结尾的 是不需要加/的
    start_urls = ['http://bj.58.com']

    def parse(self, response):
        content = response.text
        # content = response.body
        # print(content)
        # with open('58tc.html','w',encoding='utf-8') as fp:
        #     fp.write(content)
        print("=====================")
        # print("can you see me ?")
        p = response.xpath('//div[@id="rightSusp"]/div[@id="micoNew"]/p')[0]
        print(p)
        print("===========================")
        # 获取span标签里面的内容
        print(p.extract())
        # pass

